#! /bin/bash

MMDETDIR='/root/code/mmdetection/'

TARTRAIN='train2017.zip'
TARVAL='val2017.zip'

TMPDIR='/dev/shm/'
TARDIR='/group_share/coco/'

TRAINDIR=$TMPDIR
VALDIR=$TMPDIR

[ ! -e $MMDETDIR ] && git clone https://gitee.com/liuwake/mmdetection.git -b wake $MMDETDIR


echo check $TRAINDIR'train2017'
[ -e $TRAINDIR'train2017' ] && echo $TRAINDIR'train2017' OK!
[ ! -e $TRAINDIR'train2017' ] && echo $TRAINDIR'train2017' NG! NOW UNZIP: \
    && time unzip -qn $TARDIR$TARTRAIN -d $TRAINDIR

echo check $VALDIR'val2017'
[ -e $VALDIR'val2017' ] && echo $VALDIR'val2017' OK!
[ ! -e $VALDIR'val2017' ] && echo $VALDIR'val2017' NG! NOW UNZIP: \
    && time unzip -qn $TARDIR$TARVAL -d $VALDIR

echo check softlink
[ ! -e $MMDETDIR'data/coco/' ] && mkdir -p $MMDETDIR'data/coco/'

[ ! -L $MMDETDIR'data/coco/'train2017 ] && ln -s $TRAINDIR/train2017 $MMDETDIR'data/coco/'train2017
[ ! -L $MMDETDIR'data/coco/'val2017 ] && ln -s $TRAINDIR/val2017 $MMDETDIR'data/coco/'val2017


[ ! -L $MMDETDIR'data/'annotation ] && ln -s /root/coco/annotations $MMDETDIR'data/coco/'annotations
echo softlink OK!